package com.myccb.app.view.investment;


import android.annotation.SuppressLint;
import android.os.AsyncTask;

import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

/**
 * Created by freak on 17-12-6.
 */

class DataSet {
    static final String[] BENE_PERC = {"4.16%", "4.34%", "4.25%",
            "4.90%", "1.80%", "4.40%"};
    static final String[] BENE_DESCR = {"七日年化收益", "七日年化收益", "七日年化收益",
            "预期年化收益率", "预期年化收益率", "预期年化收益率"};
    static final String[] TITLES = {"健康现金添利A", "健康现金添利B", "健康现金添利C",
            "健康现金添利D", "健康现金添利E", "健康现金添利F"};
    static final String[] LIMITS = {"货币市场基金", "货币市场基金", "货币市场基金",
            "货币市场基金", "货币市场基金", "货币市场基金", };
    static final String[] ADDITIONAL = {"万份收益1.1117", "万份收益1.1213", "万份收益1.0107",
            "万份收益1.0241", "万份收益1.1417", "万份收益1.1615", };
    static final String[] ARTICLES = {};
    static final String[] DATES = {"2017/12/06", "2017/12/05", "2017/12/04",
            "2017/12/03", "2017/12/02", "2017/12/01"};

     static ArrayList<HashMap<String, String>> hashMaps= new ArrayList<>();

    @SuppressLint("StaticFieldLeak")
    static void getZiXun_ARTICLES(String string) {
        Document document;

        String title, href;
        try {
            Connection.Response response= Jsoup.connect(string)
                    .ignoreContentType(true)
                    .userAgent("Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0")
                    .referrer("http://www.baidu.com")
                    .timeout(12000)
                    .followRedirects(true)
                    .execute();

            document = response.parse();
            Elements first = document.select("div.temp01 ul li");
            int i = 0;
            for (Element ele : first) {

                if (i > 5)
                    break;
                i ++;
                Elements a = ele.select("a");
                title = a.last().text();
                href = a.last().attr("href");
                HashMap<String, String> hashMap = new HashMap<>();
                hashMap.put("title", title);
                hashMap.put("href", href);
                hashMaps.add(hashMap);
            }

        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
